package com.ems.vo;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.apache.commons.lang.StringUtils;

import java.util.Date;
import java.util.List;

/**
 * <p>
 * 电池集合,电池簇/电池堆
 * </p>
 * @author WuZH
 * @since 2023-10-28
 */
@Data
@ApiModel (value = "BatteryBoxEntity对象", description = "电池集合,电池簇/电池堆")
public class BatteryBoxVo extends BaseVo {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty ("id")
    private String id;

    @ApiModelProperty ("电池簇/堆编号")
    private String number;

    @ApiModelProperty ("系统状态：0：正常 1：禁充 2：禁放 3：禁充禁放")
    private Integer status;

    @ApiModelProperty ("丛及通信状态：0-异常，1-正常")
    private Integer salveCommStatus;

    @ApiModelProperty ("电池总压")
    private String voltage;

    @ApiModelProperty ("有符号数，充电为负放电为正")
    private String current;

    @ApiModelProperty ("电池额定容量")
    private String batteryRatedCapacity;

    @ApiModelProperty ("剩余电量/表示电池还可放电量")
    private String residueAmount;

    @ApiModelProperty ("缺少电量/表示电池还缺该电量才满电")
    private String lackAmount;

    @ApiModelProperty ("累计充电量")
    private String totalChargeAmount;

    @ApiModelProperty ("累计放电量")
    private String totalDischargeAmount;

    @ApiModelProperty ("本次充电量")
    private String dayChargeAmount;

    @ApiModelProperty ("本次放电量")
    private String dayDischargeAmount;

    @ApiModelProperty ("电池簇/堆SOC")
    private String soc;

    @ApiModelProperty ("电池簇/堆SOH")
    private String soh;

    @ApiModelProperty ("最高温度")
    private String maxTemp;

    @ApiModelProperty ("最低温度")
    private String minTemp;

    @ApiModelProperty ("电池簇/堆平均温度")
    private String avgTemp;

    @ApiModelProperty ("绝缘电阻KΩ")
    private String resistance;

    @ApiModelProperty ("商户Id")
    private String merchantId;

    @ApiModelProperty ("最高单体电压")
    private String maxVoltage;

    @ApiModelProperty ("最低单体电压")
    private String minVoltage;

    @ApiModelProperty ("平均单体电压")
    private String avgVoltage;

    @ApiModelProperty ("最高单体编号")
    private String maxSingleNumber;

    @ApiModelProperty ("最低单体编号")
    private String minSingleNumber;

    @ApiModelProperty ("最高温度编号")
    private String maxTempNumber;

    @ApiModelProperty ("最低温度编号")
    private String minTempNumber;

    @ApiModelProperty ("电池压差")
    private String batteryVoltageDiff;

    @ApiModelProperty ("电池温差")
    private String batteryTempDiff;

    @ApiModelProperty ("电池电流绝对值")
    private String batteryCurrentAbsolute;

    @ApiModelProperty ("电站Id")
    private String stationId;

    @ApiModelProperty ("上传时间")
    private Date createTime;

    @ApiModelProperty ("子设备地址")
    private String deviceAddress;

    private Integer isUsed;

    @ApiModelProperty ("电池电压")
    private BatteryVoltageVo batteryVoltageVo;

    @ApiModelProperty ("电池电感温度")
    private BatteryTempVo batteryTempVo;

    @ApiModelProperty ("电池电压原数组")
    private String[] batteryVoltage;

    @ApiModelProperty ("电池温感原数组")
    private String[] batteryTemp;

    @ApiModelProperty ("警告")
    private List<AlarmVo> alarmVoList;

    public boolean check () {
        if ( StringUtils.isBlank ( this.voltage ) && StringUtils.isBlank ( this.current ) && StringUtils.isBlank ( this.batteryRatedCapacity ) &&
                StringUtils.isBlank ( this.residueAmount ) && StringUtils.isBlank ( this.lackAmount ) && "0".equals ( this.totalChargeAmount ) && "0".equals ( this.totalDischargeAmount ) &&
                "0".equals ( this.dayChargeAmount ) && StringUtils.isBlank ( this.soc ) && StringUtils.isBlank ( this.soh ) && StringUtils.isBlank ( this.maxTemp ) &&
                StringUtils.isBlank ( this.minTemp ) && StringUtils.isBlank ( this.avgTemp ) && StringUtils.isBlank ( this.maxVoltage ) && StringUtils.isBlank ( this.minVoltage ) && StringUtils.isBlank ( this.avgVoltage )

        ) {
            return false;
        }
        return true;
    }

}
